import { get, post, del, patch ,put} from '../../utils/request';

export function cartListApi() {
  return get('cart');
}

export function changeCartNum(obj) {
  //PATCH /rest/api/v6.0/cart/count/{id}/{count}
    return put(`cart/count/${obj.id}/${obj.count}`, obj);
}
export function recommend() {
    return get('/index/recommend');
}
export function checkCart(obj) {
    //GET /rest/api/v6.0/cart/check
    return put(`/cart/check`, obj);
}
export function checkAllCart(obj) {
    //POST /rest/api/v6.0/cart/all/checked
    return post(`cart/all/checked`, obj);
}

export function delCart(obj) {
   // DELETE /rest/api/v6.0/cart/{id}
    return del(`/cart/${obj.cartId}`, { id:obj.cartId });
}
export function delCheckCart() {
    // DELETE /rest/api/v6.0/cart
    return del(`/cart`);
}

export function couponlistApi(obj) {
    //GET /rest/api/v6.0/store/coupons
    return get(`store/${obj.storeId}/coupons`, obj);
}

// 领券
export function receiveCouponApi(obj) {
    //POST /rest/api/v6.0/store/receive/coupon
    return post('store/receive/coupon', obj);
}


export function favgoods() {
    // POST /rest/api/v6.0/cart/favgoods
    return post(`cart/favgoods`);
}
export function favgoodsOne(obj) {
    //POST /rest/api/v6.0/store/favgoods
    return post('store/fav/goods', obj);
}
// 发送更改规格数据。。。
export function getSpecIdApi(obj) {
    return get(`goods/info`, obj);
}
// 获取初始specId数据。。。
export function getCartSpecApi(obj) {
    return get(`goods/cart`, obj);
}
// 提交更改规格数据。。。
export function putSpecIdApi(obj) {
    return put(`/cart/cat`, obj);
}

export function syncCart() {
    // POST /rest/api/v6.0/cart/sync
    return post(`cart/sync`);
}

export function cartSettlement() {
    // POST /rest/api/v6.0/cart/settlement
    return post(`/cart/settlement`);
}
